<template>
  <div>
    <el-form :model="form" :rules="rules" ref="ruleForm" label-width="100px">
      <el-form-item label="合同条款：" prop="infosys_content">
        <quilleditor v-model="form.infosys_content" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="save">保存</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import quilleditor from 'components/quilleditor';
import {getContract, editContract} from 'api/lineManagement/lineGlobalSettingAPI';
export default {
  components: {
    quilleditor
  },
  data() {
    return {
      form: {},
      rules: {
        infosys_content: [
          { required: true, message: '请输入合同条款', trigger: 'blur' }
        ]
      },
      content: ''
    };
  },
  methods: {
    save() {
      this.$refs.ruleForm.validate(valid => {
        if (valid) {
          this._editReserveInfo()
        }
      });
    },
    _caozuoAfter(msg){
      this.dialogFormVisible = false
      this.$message({
        message: msg,
        type: 'success'
      })
    },
    async _editReserveInfo() {
      await editContract({...this.form})
      this._caozuoAfter('编辑成功')
    },
    async _getReserveInfo() {
      let res = await getContract()
      this.form = res.rData[0]
    }
  },
  mounted() {
    this._getReserveInfo()
  }
};
</script>

<style lang="scss" scoped></style>
